home *** CD-ROM | disk | FTP | other *** search
/ The Original Shareware 1.1 / The Original Shareware (WeMake CDs)(Volume 1.1)(CDs, Inc)(1993).iso / 23 / pc_shell.zip / PC-SHELL.DOC next >
Text File  |  1986-05-27  |  45KB  |  1,122 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  68.  
  69.  
  70.           NAME              NAME  
  71.  
  72.                pc-shell - pc command processor 
  73.  
  74.           SYNOPSIS              SYNOPSIS  
  75.  
  76.                pc shell                                             pc-shell  [-s] [-v] [arg1 ... argn] 
  77.  
  78.           DESCRIPTION              DESCRIPTION  
  79.  
  80.                pc-shell is a command processor for IBM-PC's and compatibles that 
  81.                emulates  some  of  the  more desirable functions of the Berkeley
  82.                UNIX* C-shell. In addition, it implements PC-DOS versions of some 
  83.                of the common UNIX* commands - ls, mv, cp, etc.  
  84.  
  85.                     s                                                                             The -s option causes the program execute a file called "shell.rc" 
  86.                in the  current directory before passing control to the user.  If 
  87.                "shell.rc" is not found in the current directory,  the  directory
  88.                specified by the environment string "HOME" will be searched.  
  89.  
  90.                      v                                                                           The  -v  option (verbose) causes the program to echo all commands
  91.                to the standard error stream before executing them.  
  92.  
  93.                arg1     argn                                                                     arg1 ... argn (the command  line  arguments)  are  put  into  the
  94.                shell's environment as the variables $1 through $n.  
  95.  
  96.  
  97.           Wild Card Substitution              Wild Card Substitution  
  98.  
  99.                Ambiguous  file  names  are  expanded  to a list of matching file
  100.                names on the command line.  This can be defeated by quoting,  and
  101.                by setting the NOGLOB environment variable to '1'.  
  102.  
  103.                Command  lines  passed  to external programs are truncated to 128
  104.                characters.  
  105.  
  106.  
  107.           History Substitution              History Substitution  
  108.  
  109.  
  110.                History substitution is a powerful means to save retyping of long 
  111.                command lines.It allows you to do things like re-execute the last 
  112.                command, re-execute the last command but  redirect  output  to  a
  113.                file,  or  execute  a  new  command  with arguments from previous
  114.                command lines.  The last  20  commands  are  saved,  and  can  be
  115.                reviewed by typing the 'history' command.  
  116.  
  117.                Previous commands can be referred to by their number, or relative 
  118.                to the  current  command's  number.    Parameters  from  previous
  119.                commands can be seperated out and used individually.  
  120.  
  121.                History substitutions specifications come  in  two  parts  -  the
  122.                command  number   specifier and the argument specifier, seperated
  123.                by a colon.  The argument    specifier  is  optional;  if  it  is
  124.                omitted, the entire command line is specified.  
  125.  
  126.                <command specifier> ::= !! | !n | !-n 
  127.                !!  = last command
  128.  
  129.  
  130.                                               -1-
  131.  
  132.  
  133.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  134.  
  135.  
  136.                !n  = nth command
  137.                !-n = command n commands before current command number
  138.                !#  = the current command line
  139.  
  140.                <arg specifier> ::= :[^$*] | :n | :n* | <empty>
  141.                n   = number of argument (0 being the command name)
  142.                ^   = first argument (i.e. argv[1])
  143.                $   = last argument
  144.                *   = ^-$, or nothing if only one word on command line
  145.                n*  = arguments n through $
  146.  
  147.                <history subst specification> ::= <command specifier><arg specifier>
  148.  
  149.                This is  not  as  complicatated  as  it  may  appear.  Here is an
  150.                example session.  
  151.  
  152.                EXAMPLE 
  153.  
  154.                0% ls *.c
  155.                *.c
  156.                foo.c bar.c
  157.                1% more foo.c
  158.                /* edit the last argument of the last command */
  159.                2% edit !!:$            
  160.                /* go off and edit */
  161.                /* reference last argument of last command */
  162.                3% fgrep foo !!:$ bar.c 
  163.                FOO.C : foo
  164.                BAR.C : foo
  165.                /* edit the second thru the last args of command 3 */
  166.                4% edit !3:2*            
  167.                (go off and edit)
  168.                /* repeat last command */
  169.                %5 !!
  170.                (go off and edit)
  171.                /* remove the 1st argument of the command 2 before the current one */
  172.                %6 rm !-6:^
  173.  
  174.                History substitution here is a compatible subset of the [U|XE]NIX 
  175.                C shell  history  substitution  facility.    Cshell  allows  even
  176.                weirder combinations.  
  177.  
  178.  
  179.           Variable Substitution              Variable Substitution  
  180.  
  181.  
  182.                Shell  variables are synonymous for our purposes with environment
  183.                strings, i.e.  they are defined with the 'set' command.  
  184.  
  185.                Variables are referenced on  the  command  line  by  prefacing  a
  186.                variable name  by  a  dollar  sign.    Two  dollar signs in a row
  187.                signify a dollar sign character.  
  188.  
  189.                As mentioned above, command line arguments are contained  in  the
  190.                                                      n                                            shell variables, $1 through $n, where n is the number of the last 
  191.                argument.  
  192.  
  193.                EXAMPLE
  194.  
  195.  
  196.                                               -2-
  197.  
  198.  
  199.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  200.  
  201.  
  202.                %0 set home = c:/
  203.                %1 echo $home
  204.                C:/
  205.                %2 ls $home
  206.                C:/*.*
  207.                command.com
  208.                %3 echo $path
  209.                C:/bin
  210.  
  211.                And so on.  
  212.  
  213.  
  214.           Special variables              Special variables  
  215.  
  216.                There  are  a some shell variables that have special meanings for
  217.                                                              set                                 the shell.  They can be given values with the set command.   They
  218.                are 
  219.  
  220.               NOCLOBBER                  NOCLOBBER  
  221.  
  222.                        NOCLOBBER                                                                     If  NOCLOBBER is equal to '1', then existing files may not be
  223.                    destroyed by output  redirection,  and  output  files  to  be
  224.                    appended to by >> must exist.  
  225.  
  226.  
  227.               PROMPT                  PROMPT  
  228.  
  229.                         PROMPT                                                                       The  PROMPT  environment string is handled the same way as it
  230.                          COMMAND COM                                                                 is by COMMAND.COM.  There  is  one  pc-shell-specific  prompt
  231.                    string character  !    that  specifies  the  current  command
  232.                    index.  If no PROMPT environment string is defined, then  the
  233.                    default is '$!% '.  
  234.  
  235.           NOGLOB              NOGLOB  
  236.  
  237.                     NOGLOB                                                                       The  NOGLOB environment string, if set to '1', will suppress file
  238.                name expansion.  
  239.  
  240.  
  241.           Multiple commands on one command line              Multiple commands on one command line  
  242.  
  243.                Command lines are split at semicolons.  This can be  defeated  by
  244.                quoting or escaping.  
  245.  
  246.                EXAMPLE 
  247.  
  248.                %0 ls -l *.c ; make shell.exe ; exit
  249.  
  250.           Conditional command execution              Conditional command execution  
  251.  
  252.                If  two  commands  are seperated by '&&', then the second will be
  253.                executed only if the first returns 0 as an exit  code.    If  two
  254.                commands  are seperated by '||', then the second will be executed
  255.                only the first command returns non-zero as an exit code.  
  256.  
  257.                Example 
  258.  
  259.                    make shell.exe && chmod +w /bin/shell.exe && mv shell.exe /bin 
  260.  
  261.  
  262.                                               -3-
  263.  
  264.  
  265.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  266.  
  267.  
  268.                    If the make operation fails, then the chmod and the  mv  will
  269.                    not be executed.  
  270.  
  271.                    make shell.exe || echo You blew it bub!
  272.  
  273.                    If  the make operation fails, then the echo operation will be
  274.                    executed.  
  275.  
  276.  
  277.           Character Escapes  Shell Comments  and Argument Quoting              Character Escapes, Shell Comments, and Argument Quoting  
  278.  
  279.                Any character preceded by a  \ (backslash) is  copied  unmodified
  280.                to the  command  buffer.  This allows you to suppress the special
  281.                meanings of shell command characters, such as '|',  ';',  and  '*
  282.                '.  
  283.  
  284.                # is  the  shell comment character.  Anything on a line after a #
  285.                character is ignored.  
  286.  
  287.                Command line arguments contained in quotes (single or double) may 
  288.                contain blank space (i.e. blanks or tabs).  Variable substitution 
  289.                will take place within strings surrounded by double quotes.    No
  290.                interpretation takes place within single quotes.   
  291.  
  292.                Within   double   quotes,   the  'C'  language  escape  sequences
  293.                \r,\n,\b,\f, and \a are honored - i.e.  they are mapped to  their
  294.                corresponding control characters.  
  295.  
  296.  
  297.           Startup and Script Files              Startup and Script Files  
  298.  
  299.  
  300.                If  '-s'  is  specified on the command line the program will look
  301.                for a file called SHELL.RC in the current directory, and  execute
  302.                it before  passing    control to the console.  This allows you to
  303.                set up all your alias commands.  It isn't a good idea to  put  an
  304.                'exit'   command  in  your  SHELL.RC  file,  as  the  shell  will
  305.                terminate.  
  306.  
  307.                                             sh                                                   Any file whose extension is .sh is run as a command  file.    The
  308.                environment  string  PATH is used to locate the script file if it
  309.                isn't in the current directory.  .sp 1 There is  also  a  command
  310.                sh                                                                                sh,  into  which  shell scripts whose extension is not .sh can be
  311.                redirected as standard input.  
  312.  
  313.                EXAMPLE
  314.  
  315.                %0 sh <batch.fil        # use the sh command
  316.                %1 shell <batch.fil     # run the external program
  317.  
  318.  
  319.           INPUT OUTPUT              INPUT/OUTPUT  
  320.  
  321.                                                          COMMAND COM                             I/O redirection operates as it does under COMMAND.COM  with  some
  322.                additional options: 
  323.  
  324.             name              <name 
  325.  
  326.  
  327.  
  328.                                               -4-
  329.  
  330.  
  331.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  332.  
  333.  
  334.                               name                                          Opens the file name as the standard input.  
  335.  
  336.              word              <<word 
  337.  
  338.                                                                            word                  reads  the  shell  input up to a line which is identical to word.
  339.                The resulting text is put into an anonymous temporary file, which 
  340.                is given to the command as standard input.  
  341.  
  342.                 name                 >name
  343.                  name                 >!name
  344.                  name                 >&name
  345.                   name                 >&!name
  346.  
  347.                             name                                                                     The file name  is used as standard output.    If  it  doesn't
  348.                    exist,  it's  created; if it exists, it is truncated, and its
  349.                    previous contents are lost.  
  350.  
  351.                                    NOCLOBBER                                                         If the variable NOCLOBBER is set, the file must  not  already
  352.                    exist, or  an  error results.  The forms using an exclamation
  353.                    point override the NOCLOBBER variable's action.  
  354.  
  355.                               name                                                                   The form >&name routes standard  error  along  with  standard
  356.                              name                        output to name.  
  357.  
  358.                  name                 >>name
  359.                   name                 >>!name
  360.                   name                 >>&name
  361.                    name                 >>&!name
  362.  
  363.                                     name                                                             Uses  the  file  name  as standard output, like >, but places
  364.                                                                NOCLOBBER                              output at the end of file.  If the variable NOCLOBBER is set, 
  365.                    it is an error if the file doesn't already exist.  The  forms
  366.                    using  an exclamation point override the NOCLOBBER variable's
  367.                    action.  
  368.  
  369.  
  370.               BUILT IN COMMANDS                  BUILT-IN COMMANDS  
  371.  
  372.  
  373.                    Some of the internal commands are  UNIX*  style  replacements
  374.                    for  COMMAND.COM internal commands, and some are included for
  375.                    convenience.  
  376.  
  377.                        Output of the 'commands' command
  378.  
  379.                        a:              alias           b:              c:
  380.                        cat             cd              chdir           chmod
  381.                        cls             commands        copy            cp
  382.                        d:              del             dir             dump
  383.                        e:              echo            era             erase
  384.                        error           exit            f:              fgrep
  385.                        g:              h:              hd              history
  386.                        i:              j:              ls              md
  387.                        mkdir           mon             more            mv
  388.                        popd            pushd           pwd             rd
  389.                        read            rm              rmdir           set
  390.                        sh              switchar        tee             touch
  391.                        unalias         version         y
  392.  
  393.  
  394.                                               -5-
  395.  
  396.  
  397.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  398.  
  399.  
  400.                    There are many that are simply aliases, e.g.  'copy' and 'cp' 
  401.                    invoke the same program.  
  402.  
  403.  
  404.               COMMAND DESCRIPTION SYNTAX                  COMMAND DESCRIPTION SYNTAX  
  405.  
  406.                    terms used in syntax explanations :
  407.                    
  408.                    fname ::= PC-DOS ambiguous or unambiguous file or directory name.
  409.                    
  410.                    uname ::= unambiguous PC-DOS file or directory name
  411.                    
  412.                    string ::= any string of printable characters of arbitrary(<512) length.
  413.                    
  414.                    filelist ::= filename [filename .. filename]
  415.                    
  416.                    noargs ::= no arguments at all
  417.                    
  418.                    space ::= any white space characters
  419.                    
  420.                    [arg] ::= term is optional
  421.                    
  422.                    envstring ::=    <string>=<string> | <string><space>=<space><string> |
  423.                 <string><space><string>
  424.  
  425.  
  426.               COMMANDS                  COMMANDS  
  427.  
  428.  
  429.                    drive                     drive
  430.  
  431.                        a: | b: | c: | d: | e: | f: | g: | h: | i: | j: <noargs> 
  432.  
  433.                        changes default drive.  If you don't have such  a  drive,
  434.                        nothing happens.  
  435.  
  436.                    alias                     alias
  437.  
  438.                        alias <envstring> 
  439.  
  440.                        assigns cmdstring  to name.  name can now be used just as
  441.                        if it were a built-in or external command.  cmdstring may 
  442.                        contain history expressions or variable substitutions.  
  443.  
  444.                        The syntax of this command is flexible - you can  specify
  445.                        alii  (?)  in  the form 'name=subst','name subst','name =
  446.                        subst', or  'name  =subst.'  However  you  need  a  space
  447.                                   before                                                                 character  before  a  single quote in order to specify an
  448.                        alias that contains blanks.  
  449.  
  450.                            alias     set                                                                 The alias and set commands  are  case  sensitive,  unlike
  451.                                         COMMAND COM                            their analogs in COMMAND.COM.  
  452.  
  453.                    cat                     cat
  454.  
  455.                        cat [<filelist>] 
  456.  
  457.                        copies specified  files  to standard output.  If none are
  458.  
  459.  
  460.                                               -6-
  461.  
  462.  
  463.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  464.  
  465.  
  466.                        given, copies standard input to standard output 
  467.  
  468.                    cp                     cp
  469.  
  470.                        cp | copy <filelist> <uname> 
  471.  
  472.                        copies specified files to destination file or device.  If 
  473.                        more than one file is in the file list, <uname> must be a 
  474.                        directory.  
  475.  
  476.                    cd                     cd
  477.  
  478.                        cd | chdir <dirname> 
  479.  
  480.                        makes <dirname> the current default directory.  
  481.  
  482.                    chmod                     chmod
  483.  
  484.                        chmod [-|+[arwhs]*] <filelist> 
  485.  
  486.                        change file permissions for specified files 
  487.  
  488.                        +r, -r turn on or off read permission - i.e. hide the file.
  489.                        +w, -w turn on or off write permission.
  490.                        +h, -h turn on or off hidden attribute - converse of r
  491.                        +a, -a turn on or off archive attribute
  492.                        +s, -s turns on or off the system attribute
  493.  
  494.                        Note that '-r'  or  '+rwh'  are  both  valid  syntax  for
  495.                        switches.   Also  new permission switches are permissable
  496.                        between file names with the following  warning:  I  don't
  497.                        reset the masks between file names - if you have a second 
  498.                        batch  of  attribute  changes  on  the  command line, the
  499.                        effect is additive.  If you're  not  careful,  you  could
  500.                        make a mess of a files attributes.  
  501.  
  502.                        If   you  don't  specify  any  attribute  switches,  file
  503.                        attributes will be set to 0, which  means  read,write,not
  504.                        hidden,not system, not  modified since last backup.  
  505.  
  506.                    cls                     cls
  507.  
  508.                        cls <noargs> 
  509.  
  510.                        clears the screen and homes the cursor.  
  511.  
  512.                    commands                     commands
  513.  
  514.                        commands <noargs> 
  515.  
  516.                        prints a  table  of  available  built-in  commands.  (see
  517.                        above) 
  518.  
  519.                    del                     del
  520.  
  521.                        del 
  522.  
  523.                        synonym for rm.  
  524.  
  525.  
  526.                                               -7-
  527.  
  528.  
  529.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  530.  
  531.  
  532.                    dir                     dir
  533.  
  534.                        dir 
  535.  
  536.                        synonym for ls.  
  537.  
  538.                    dirs                     dirs
  539.  
  540.                        dirs <noargs> 
  541.  
  542.                        lists the directories on the directory stack.  (see pushd 
  543.                        and popd) 
  544.  
  545.                    du                     du
  546.  
  547.                        du [drivename] 
  548.  
  549.                                                             drivename                                    prints out remaining space on drive  drivename.   If  you
  550.                        leave  off  the  drivename,  it  defaults  to the current
  551.                        drive.  
  552.  
  553.                    dump                     dump
  554.  
  555.  
  556.                        dump filespec [block [page]] | [segment:[offset]] [count] 
  557.  
  558.                        Where a block is 64K bytes and a page is 256 bytes
  559.                        Segment:offset are standard 8086 notation in hexadecimal
  560.                        Count is the number of bytes to dump in decimal
  561.  
  562.                        This came from some anonymous public domain source, ported by me
  563.  
  564.                    echo                     echo
  565.  
  566.                        echo <anything> 
  567.  
  568.                                                            echo  on                                      echos argument list  to  screen.    echo  on  causes  all
  569.                        commands  to  be  echoed  before execution (i.e. sets the
  570.                                         echo off                                                       verbose  flag).  echo off turns off the verbose flag.  
  571.  
  572.                    era                     era
  573.  
  574.                        era 
  575.  
  576.                        synonym for rm.  
  577.  
  578.                    error                     error
  579.  
  580.                        error <noargs> 
  581.  
  582.                        prints returned value of last command to the screen.  
  583.  
  584.                    exit                     exit
  585.  
  586.                        exit <noargs> 
  587.  
  588.                        terminates execution of the currently running  sub-shell.
  589.                        If  you are at top level of execution, you will return to
  590.  
  591.  
  592.                                               -8-
  593.  
  594.  
  595.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  596.  
  597.  
  598.                        dos.  
  599.  
  600.                    fgrep                     fgrep
  601.  
  602.                        fgrep <pattern> <filelist> 
  603.  
  604.                        looks for unambiguous pattern  <pattern>  in  <filelist>.
  605.                        echos lines matching to the screen.  
  606.  
  607.                    history                     history
  608.  
  609.                        history [size] 
  610.  
  611.                                                                          size                            prints history  list  to  standard  output.    If size is
  612.                        given, the number of commands history remembers is set to 
  613.                        size                                                                              size.  If you change  the  size,  history  'forgets'  all
  614.                        previous commands and resets its counters to 0.  
  615.  
  616.                    ls                     ls
  617.  
  618.                        ls | dir [-[alqctrR]] <filelist> 
  619.  
  620.                        Lists files that match <filelist> 
  621.  
  622.                        -a all files, including system files are listed.  '.' and 
  623.                        '..'  are  suppressed,  but you know they're there if you
  624.                        need them, don't you?  
  625.                        -l prints out file times, permissions, etc 
  626.                        -q suppresses header line from display - useful when  you
  627.                        want to pipe stuff into another program.  
  628.                        -c print as one column.  
  629.                        -t sort by time, most recent last 
  630.                        -R recurse through all encountered subdirectories.  
  631.                        -r reverses sort order.  
  632.  
  633.                    md                     md
  634.  
  635.                        md | mkdir <uname> 
  636.  
  637.                        make a directory.  Prints an error if it can't be done 
  638.  
  639.                    mon                     mon
  640.  
  641.                        mon <noargs> 
  642.  
  643.                        mon                                                                                mon prints to standard error a lot of cryptic information 
  644.                        on system variables thusly: 
  645.  
  646.                            Corg : 0000 Cend : 715a Dorg : 0002 Dend 167a
  647.                            Uorg : 167a Uend : 327a mbot : 427c mtop 4800
  648.                            sbot : 0000 PSP  : 490d STKSIZ : 00256 HEAPSIZ : 00064
  649.                            dsval : 5033 csval : 491d
  650.                            STKLOW : 0001 MEMRY : 4680
  651.                            CS : 491d DS : 5033 SP : 4186
  652.  
  653.                        You  can  probably  figure out what most of the variables
  654.                        mean.  If you have source and have broken the shell, this 
  655.                        command may help.  
  656.  
  657.  
  658.                                               -9-
  659.  
  660.  
  661.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  662.  
  663.  
  664.                    more                     more
  665.  
  666.                        more [-[0-9]*] [<filelist>] 
  667.  
  668.                        List file to screen with pauses 
  669.  
  670.                        -n specify tab width when expanding tabs, where n  is  an
  671.                        integer.   more acts like 'cat' when redirected - you can
  672.                        concatenate files in  this  manner.    If  no  files  are
  673.                        specifed, standard input is 'mored.' 
  674.  
  675.                    mv                     mv
  676.  
  677.                        mv [-v] <filelist> <uname> 
  678.  
  679.                        moves  specified  file  or  files  to  target specifed by
  680.                        <uname>.  If there is more than one file in list, <uname> 
  681.                        must be a directory 
  682.  
  683.                         v                                                                                -v  will  print  out  a  message   saying   how   it   is
  684.                        accomplishing   the   move,   which   is   probably  more
  685.                        interesting to me than you.  
  686.  
  687.                    popd                     popd
  688.  
  689.                        popd <noargs> 
  690.  
  691.                        returns to directory at top of directory stack.  
  692.  
  693.                    pushd                     pushd
  694.  
  695.                        pushd <uname> 
  696.  
  697.                        save current working directory on  directory  stack,  and
  698.                        changes current working directory to <uname>.  
  699.  
  700.                    pwd                     pwd
  701.  
  702.                        pwd 
  703.  
  704.                        prints current working directory to standard output.  
  705.  
  706.                    read                     read
  707.  
  708.                        read vname0 [vname1 .. vnamen] 
  709.  
  710.                        read                                                                              read  reads  a line from standard input, and assigns each
  711.                        word from  the  line  to  the  corresponding  environment
  712.                                               vname0          vnamen                            variable specified by  vname0  through vnamen.  
  713.  
  714.                        EXAMPLE 
  715.  
  716.                            read a b    # read into environment variables a and b
  717.                        you type
  718.                            hello there
  719.                            echo $a
  720.                        the shell echos
  721.                            hello
  722.  
  723.  
  724.                                              -10-
  725.  
  726.  
  727.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  728.  
  729.  
  730.                            echo $b
  731.                        there
  732.  
  733.                        If there are fewer environment variables specified on the 
  734.                        command  line  than  there are words in the command line,
  735.                        the last environment variable will contain  the  rest  of
  736.                        the words on the line.  
  737.  
  738.                        EXAMPLE 
  739.  
  740.                            read a b    # read into environment variables a and b
  741.                        you type
  742.                            hello there Mister Jones
  743.                            echo $a
  744.                        the shell echos
  745.                            hello
  746.                            echo $b
  747.                        there Mister Jones
  748.  
  749.                        If  there  are  more environment variables on the command
  750.                        line than words on the line read from standard input, the 
  751.                        left-over environment variables' state will not change  -
  752.                        if  they  were  defined in the environment already, their
  753.                        status won't change, and if they  weren't  defined,  they
  754.                        stay undefined.  
  755.  
  756.                    rd                     rd
  757.  
  758.                        rd | rmdir <uname> 
  759.  
  760.                        remove specified directory if possible.  
  761.  
  762.                    rm                     rm
  763.  
  764.                        rm [-q] <filelist> 
  765.  
  766.                        blows  away  all files in <filelist>. If -q is specified,
  767.                        will ask if they should be removed.  
  768.  
  769.                    set                     set
  770.  
  771.                        set [<envstring>] 
  772.  
  773.                        sets a string in the environment.  If you specify 'name=' 
  774.                        with  no  string  after,  it  will  remove  it  from  the
  775.                        environment.   If  you don't specify a string, set prints
  776.                        out current environment.  
  777.  
  778.                        The syntax of this command is flexible - you can  specify
  779.                        set  in  the  form 'set name=subst','set name subst','set
  780.                        name = subst', or 'set name =subst.' However you  need  a
  781.                                        before                                                             space character before a single quote in order to specify 
  782.                        a substitution string that contains blanks.  
  783.  
  784.                    sh                     sh
  785.  
  786.                        sh [ <arg1> .. <argn>] <scriptfile 
  787.  
  788.  
  789.  
  790.                                              -11-
  791.  
  792.  
  793.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  794.  
  795.  
  796.                        forks a  'local'  shell  -  i.e.    saves  all  pertinent
  797.                        information about  the  shell  you're  currently  in  and
  798.                        invokes  the command processor function recursively, with
  799.                        scriptfile                                                                        scriptfile as input.  The  arguments  are  copied  to  $1
  800.                        through  $N  environment strings, overwriting the startup
  801.                        arguments.  
  802.  
  803.                        sh                                                                                sh gives you a way to run  scripts,  without  loading  an
  804.                        extra copy of shell.com or small.com.  
  805.  
  806.                    switchar                     switchar
  807.  
  808.                        switchar [schar] 
  809.  
  810.                                                          schar      schar                                sets the  DOS switch character to schar.  If schar is not
  811.                        given, the current switch character is echoed.  
  812.  
  813.                    tee                     tee
  814.  
  815.                        tee <uname> 
  816.  
  817.                        Copies standard input to standard  output,  depositing  a
  818.                        copy in <uname> 
  819.  
  820.                    touch                     touch
  821.  
  822.                        touch <filelist> 
  823.  
  824.                        Makes  the  modification  time  of  specified  files  the
  825.                        current date and time.  
  826.  
  827.                    unalias                     unalias
  828.  
  829.                        unalias aliasname 
  830.  
  831.                        remove alias name from the alias list.  
  832.  
  833.                    y                     y
  834.  
  835.                        y <filelist> 
  836.  
  837.                        copies standard input to standard output, and then copies 
  838.                        the specified files to standard  output.    Sort  of  the
  839.                        opposite of tee, in other words.  
  840.  
  841.  
  842.               The Small Shell                  The Small Shell  
  843.  
  844.  
  845.                    Included  in release 2.0 or later is a 'small' version of the
  846.                    shell.   This version will take up less than 30K of memory at 
  847.                     runtime (as verified by chkdsk).  What's the catch?    Well,
  848.                    ls,  cp,  mv, more, fgrep, and dump become external commands.
  849.                    I am not going to distribute these commands; you  can  either
  850.                    make  them    yourself,  or  you can use whatever you have on
  851.                    hand.  If you need to use the COMMAND.COM copy facility,  try
  852.                    putting these commands in your SHELL.RC file 
  853.  
  854.  
  855.  
  856.                                              -12-
  857.  
  858.  
  859.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  860.  
  861.  
  862.                    alias cp 'command -c copy'
  863.                    alias ls 'command -c dir -w | sort'
  864.  
  865.                    The   removed   commands   accounted  for  over  10K  of  the
  866.                    shell.com.  
  867.  
  868.               Helpful hints                  Helpful hints  
  869.  
  870.  
  871.                    Use forward slashes in all path names.  (See  note  below  on
  872.                    switch  characters)    If  you  use  DOS  3.0 or higher, this
  873.                    includes paths to transient programs.  
  874.  
  875.                    put single quotes around arguments with semicolons  in  them,
  876.                    so they don't turn into command delimiters.  
  877.  
  878.                    The  set  command affects only the local shell's environment.
  879.                    You can 'exit' to command.com and the original environment is 
  880.                    intact.  The  local  environment  is  2K  large  -  which  is
  881.                    useful.  
  882.  
  883.                    When  using  the  Microsoft  C  compiler  under pc-shell, the
  884.                    compiler has a bad habit of  look  for  parameters  beginning
  885.                    with forward  slashes  in  the environment.  If you get their
  886.                    famous  'P0  :  bad  option'  message,   try   revising   the
  887.                    environment.  
  888.  
  889.  
  890.               Implementation notes                  Implementation notes  
  891.  
  892.  
  893.                    DOS  doesn't  acknowledge  a  'change  default drive' command
  894.                    until you issue a 'get current directory' call.   Why?    The
  895.                    only way I figured this out is by disassembling command.com.  
  896.  
  897.                    PC|MS-DOS has  a  limit  of  20  file  handles.  If you add a
  898.                    command that opens files, make sure you catch the  ctrl-break
  899.                    signal and close them.  Look at CAT.C or Y.C for examples.  
  900.  
  901.                    DON'T  REDIRECT  INPUT  INTO  PRINT. Print gets all hosed up.
  902.                    Print has lots of trouble in general with the  pc-shell,  and
  903.                    should be avoided.  
  904.  
  905.               BUGS                  BUGS  
  906.  
  907.  
  908.                    Due  to  the way that environment strings are expanded on the
  909.                    command line, semicolons inside  shell  variables  look  like
  910.                    command seperators.    If  you enclose them in double quotes,
  911.                    the problem will go away.  
  912.  
  913.                    I have noticed intermittent problems running on an  AT,  with
  914.                    DOS  3.0,  but  have been unable to reproduce them on a PC. I
  915.                    suspect bugs in DOS 3.0 that are absent in 3.1. If you notice 
  916.                    any consistent problems, send  me a bug report.  
  917.  
  918.               HISTORY                  HISTORY  
  919.  
  920.  
  921.  
  922.                                              -13-
  923.  
  924.  
  925.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  926.  
  927.  
  928.                   V 2 0                      V 2.0  
  929.  
  930.                        Minor bug fixes.  Started allocating command buffers  out
  931.                        of heap rather than stack, reducing stack usage.  Stopped 
  932.                        releasing source with executables.  
  933.  
  934.                   V 2 1                      V 2.1  
  935.  
  936.                        Fixed the bug that made "mv foo .." throw away the source 
  937.                        file and  move  it to "..foo", (i.e. nowhere).  Added the
  938.                        sh command,  that  allows  you  to  run  scripts  without
  939.                        re-invoking the shell.  
  940.  
  941.                   V 2 2                      V 2.2  
  942.  
  943.                        Fixed  the bug that locked pc up when a command line with
  944.                        a leading ; was entered.  Changed fork code so that files 
  945.                        with the extension .sh are run as scripts.    The  equals
  946.                        sign in alias and set is now optional.  
  947.  
  948.                   V 2 3                      V 2.3  
  949.  
  950.                        Removed  information  about versions 1.0 through 1.6 from
  951.                        documentation, adding any relevant material to  the  tips
  952.                        or implementation  notes sections.   Added redirection of
  953.                        standard error, and checking for  NOCLOBBER.  Implemented
  954.                        execution of the prompt string.  
  955.  
  956.  
  957.                   V 2 4                      V 2.4  
  958.  
  959.                        The  problem running external programs written by IBM and
  960.                        Microsoft  has  finally  been  traced  to  Aztecs  fexecv
  961.                        function.   When  is  an  ASCIIZ  string  not  an  ASCIIZ
  962.                        string?  When you need to put a single carriage return on 
  963.                        the end of it.  THANKS to Programmers Journal. NOTE  WELL
  964.                        that  needing  a carriage return in your command tail for
  965.                        EXEC calls is note documented in the IBM PC-DOS technical 
  966.                        reference.  
  967.  
  968.                        All references to the  Aztec  screen  library  have  been
  969.                        removed,  so  this  should  work  on Rainbows, Compupros,
  970.                        AMPROs etc.  etc.  etc.  ls is slower, but  its  a  small
  971.                        price to  pay.    If  you want a fast version, one can be
  972.                        created for you if you mail a contribution (hint,hint).  
  973.  
  974.                        mv now will do the right thing when you try to move to  a
  975.                        drive  that  has been joined to a directory (DOS 3.1). It
  976.                        also now has a  verbose  switch,  which  tells  you  what
  977.                        exactly its doing.  When I started writing a mv, I had no 
  978.                        idea  how  many  special  cases I would have to take care
  979.                        of.  
  980.  
  981.                   V 2 5                      V 2.5  
  982.  
  983.                        Problem with using the wrong path to search for  external
  984.                        programs solved.    Main  command line parsing changed so
  985.                        that  NOGLOB  could  be  used  to  suppress   file   name
  986.  
  987.  
  988.                                              -14-
  989.  
  990.  
  991.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  992.  
  993.  
  994.                        expansion.  
  995.  
  996.                   V 2 6                      V 2.6  
  997.  
  998.                        Many stupid  bugs  in 2.5 are addressed (sorry folks).  I
  999.                        now peek inside double quotes to do  variable  expansion.
  1000.                        Double quotes are now stripped.  
  1001.  
  1002.                   V 2 7                      V 2.7  
  1003.  
  1004.                        Added read.    Fixed  bug  in  ls that would occasionally
  1005.                        leave you in a different directory.    The  exit  command
  1006.                        will  now  just  pop  you out a level of shell execution,
  1007.                        rather than kicking you out to the DOS prompt.  
  1008.  
  1009.                   V 2 8                      V 2.8  
  1010.  
  1011.                        Fixed bug  in  more  that  made  it  puke  when  you  hit
  1012.                        <CTRL>-<BREAK> at the bottom of a screen-full.  Made move 
  1013.                        and  cp  preserve  file  times when they have to create a
  1014.                        target.  
  1015.  
  1016.                   V 2 9                      V 2.9  
  1017.  
  1018.                        Fixed bug in ls that caused it to get confused  when  you
  1019.                        did an  'ls  -R'  on  a  drive other than default.  Also,
  1020.                        stopped it from hanging on an empty pipe.  Added the 'du' 
  1021.                        command - which is simply the last line of ls  -l.  Shell
  1022.                        scripts will now be searched for on PATH.  
  1023.  
  1024.  
  1025.                   DONATIONS REQUESTED                      DONATIONS REQUESTED  
  1026.  
  1027.  
  1028.                        The shell seems to have generated an incredible amount of 
  1029.                        interest, all around the country - someone apparently put 
  1030.                        this code out over the usenet and arpanet, in addition to 
  1031.                        its original FIDOnet roots.  
  1032.  
  1033.                        I  would  like  to  keep  working  on  it,  but for it to
  1034.                        progress further, it can  no  longer  be  a  'lunch  hour
  1035.                        hack.' I am therefore requesting that those who feel that 
  1036.                        this  is a useful piece of software send me a donation to
  1037.                        further my efforts towards purchasing a machine for  home
  1038.                        use.  
  1039.  
  1040.                        Anyone  sending  more  that 25$ will recieve: 1. a PC-DOS
  1041.                        disk with most recent release full source and  executable
  1042.                        image.  2. Source and executable for various other public 
  1043.                        domain  *nix  programs  (tail,  nroff,  cut, paste, diff,
  1044.                        grep) 
  1045.  
  1046.                        If you use this every day, or if you are giving  everyone
  1047.                        in   your   place   of   employment   a  copy,  value  it
  1048.                        accordingly.  
  1049.  
  1050.                        This does not constitute a  licensing  agreement  of  any
  1051.                        sort, nor  is any warranty implied.  Once you have a copy
  1052.  
  1053.  
  1054.                                              -15-
  1055.  
  1056.  
  1057.                PC-SHELL (1)             PC-DOS C Shell              PC-SHELL (1)
  1058.  
  1059.  
  1060.                        of this program or its source,  it's  yours  to  hack  to
  1061.                        pieces, use,  revere,  revile,  or  whatever.  I like the
  1062.                        anarchic aspects of the various public domain networks.  
  1063.  
  1064.                        QUESTIONS COMMENTS BUGREPORTS GOTO 
  1065.                        KENT WILLIAMS
  1066.                        722 Rundell St.
  1067.                        Iowa City, IA 52240
  1068.                        (319) 338-6053 (HOME VOICE)
  1069.                        
  1070.                        * UNIX is an unregistered trademark of AT&T.
  1071.  
  1072.  
  1073.  
  1074.  
  1075.  
  1076.  
  1077.  
  1078.  
  1079.  
  1080.  
  1081.  
  1082.  
  1083.  
  1084.  
  1085.  
  1086.  
  1087.  
  1088.  
  1089.  
  1090.  
  1091.  
  1092.  
  1093.  
  1094.  
  1095.  
  1096.  
  1097.  
  1098.  
  1099.  
  1100.  
  1101.  
  1102.  
  1103.  
  1104.  
  1105.  
  1106.  
  1107.  
  1108.  
  1109.  
  1110.  
  1111.  
  1112.  
  1113.  
  1114.  
  1115.  
  1116.  
  1117.  
  1118.  
  1119.  
  1120.                                              -16-
  1121.  
  1122.